//
//  MainTabController.swift
//  Fancyswap
//
//  Created by Jonathan Muschalle on 2015-03-22.
//  Copyright (c) 2015 Jonathan Muschalle. All rights reserved.
//

import UIKit

class MainTabController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()

        var viewControllerArray:NSMutableArray = NSMutableArray(capacity: 2)
        viewControllerArray.addObject(UIStoryboard(name: "ItemList", bundle: nil).instantiateViewControllerWithIdentifier("itemList"))
        viewControllerArray.addObject(UIStoryboard(name: "ItemAdd", bundle: nil).instantiateViewControllerWithIdentifier("itemAdd"))
        
        self.setViewControllers(viewControllerArray, animated: true)

    }

    override func preferredStatusBarStyle() -> UIStatusBarStyle {
        return UIStatusBarStyle.LightContent
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    override func viewDidAppear(animated: Bool) {
        
//        let z = Authentification()
//        
//        if( z.isLoggedIn() == false ){
//            self.authentication(self)
//        }
    }

    func authentication(sender: AnyObject) {
        
        var storyboard = UIStoryboard(name: "Authentication", bundle: nil)
        var controller = storyboard.instantiateViewControllerWithIdentifier("authentication") as UIViewController
        self.presentViewController(controller, animated: true, completion: nil)
    }
}
